<?php
Yii::app()->clientScript->registerScript('note', "
	$('.note').click(function(){
		$('.note-form').toggle();
		return false;
	});
");
?>
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'monitoring-form',
	'enableAjaxValidation'=>true,
	'enableClientValidation'=>false,
       'clientOptions' => array(
            'validateOnSubmit'=>true,
            'validateOnChange'=>true,
            'validateOnType'=>false,
           ),

)); ?>

<?php echo Yii::t('view', '<p class="help-block">Fields with <span class="required">*</span> are required.</p>');?>

<?php echo $form->errorSummary($model); ?>

	<?php 
        echo  '';
			$dataMobil = Mobil::model()->findAll(array('order' => 'noPolisi'));
		    $listMobil = CHtml::listData($dataMobil,'id', 'noPolisi');
                    echo $form->select2Row($model, 'tb_mobil_id', array(
			   'data' => $listMobil,
                            'options' => array(
                                    'placeholder' => 'Pilih No Polisi',
                                ),
                        ), array('class'=>'span5')); 
                    ?>
       <?php echo CHtml::link('<i class="icon-plus-sign"></i>', array('mobil/create'), array('class' => 'btn btn-default', 'style' => 'height:18px'));?>
       
       <?php echo $form->textFieldRow($model,'noDokumen',array('class'=>'span5','maxlength'=>20)); ?>

        <?php  echo $form->radioButtonListRow($bongkarMuat, 'statusMobil', 
                                                            array(
                                                                'Bongkar'=>'Bongkar',
                                                                'Muat'=>'Muat')
                );?>
<?php echo CHtml::link(Yii::t('view', 'Tambah catatan'),'#',array('class'=>'note')); ?>
<div class="note-form" style="display:none">
	<?php echo $form->textFieldRow($notes,'isi',array('class'=>'span5','maxlength'=>20)); ?>
</div><!-- notes-form -->
	<?php echo $form->textFieldRow($kartu,'noTiket',array('class'=>'span5','maxlength'=>20)); ?>
<div class="form-actions">
	<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
                        'loadingText'=>'Loading...',
//                        'url'=>Yii::app()->createUrl('monitoring/create'),
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
//                        'ajaxOptions'=>array(
//                            'type'=>'POST',
//                            'dataType'=>'json',
//                            'data'=>'js:{$("monitoring-form form").serialize()}',
//                            'success'=>'js:function(data)
//                                {
//                                    if(data.status==="failure")
//                                        alert("Fail");
//                                    else
//                                        $.fn.yiiGridView.update("checkpoint-grid");
//                                }'
//                        ),
		)); ?>
</div>      
        
<?php $this->endWidget(); ?>